package com.ycg.blog.pojo;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;


/**
 * 网站信息表
 * @TableName blog_info
 */
@TableName(value ="blog_info")
@Data
public class WebInfo implements Serializable {
    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 昨日访问, 每天12点计算
     */
    private Integer yesterdayViews;

    /**
     * 本月访问
     */
    private Integer monthViews;

    /**
     * 总访问数
     */
    private Integer totalViews;

    /**
     * 总字数
     */
    private Integer count;

    /**
     * 上次更新时间
     */
    private String lastUpdate;

    /**
     * 插入时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        WebInfo other = (WebInfo) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getYesterdayViews() == null ? other.getYesterdayViews() == null : this.getYesterdayViews().equals(other.getYesterdayViews()))
            && (this.getMonthViews() == null ? other.getMonthViews() == null : this.getMonthViews().equals(other.getMonthViews()))
            && (this.getTotalViews() == null ? other.getTotalViews() == null : this.getTotalViews().equals(other.getTotalViews()))
            && (this.getCount() == null ? other.getCount() == null : this.getCount().equals(other.getCount()))
            && (this.getLastUpdate() == null ? other.getLastUpdate() == null : this.getLastUpdate().equals(other.getLastUpdate()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getYesterdayViews() == null) ? 0 : getYesterdayViews().hashCode());
        result = prime * result + ((getMonthViews() == null) ? 0 : getMonthViews().hashCode());
        result = prime * result + ((getTotalViews() == null) ? 0 : getTotalViews().hashCode());
        result = prime * result + ((getCount() == null) ? 0 : getCount().hashCode());
        result = prime * result + ((getLastUpdate() == null) ? 0 : getLastUpdate().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", yesterdayViews=").append(yesterdayViews);
        sb.append(", monthViews=").append(monthViews);
        sb.append(", totalViews=").append(totalViews);
        sb.append(", count=").append(count);
        sb.append(", lastUpdate=").append(lastUpdate);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}